package com.mysteel.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.mysteel.common.to.SkuHasStockTo;
import com.mysteel.common.to.mq.OrderTo;
import com.mysteel.common.to.mq.StockLockedTo;
import com.mysteel.common.utils.PageUtils;
import com.mysteel.ware.entity.WareSkuEntity;
import com.mysteel.ware.exception.NoStockException;
import com.mysteel.ware.vo.LockStockResult;
import com.mysteel.ware.vo.WareSkuLockVo;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author xc
 * @email xcremote@163.com
 * @date 2020-12-11 09:34:24
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    PageUtils queryPageOnCondition(Map<String, Object> params);

    void addStock(Long skuId, Long wareId, Integer skuNum);

    List<SkuHasStockTo> getSkuHasStock(List<Long> skuIds);

    Boolean lockOrderStock(WareSkuLockVo lockVo) throws NoStockException;

    void handleStockLockedRelease(StockLockedTo stockLockedTo) throws Exception;

    void unlockStock(OrderTo orderTo) throws Exception;
}

